//
//  JEHLeftTableViewCell.m
//  SinaNews
//
//  Created by 蒋恩浩 on 15/12/5.
//  Copyright © 2015年 JEH. All rights reserved.
//

#import "JEHLeftTableViewCell.h"

@implementation JEHLeftTableViewCell

- (void)dealloc {
    [_title release];
    [_firstImage release];
    [_backView release];
    [_titleLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.titleLabel.frame = self.bounds;
    self.firstImage.frame = CGRectMake(20, 0, self.width - 40, self.height);
}

- (void)setTitle:(NSString *)title {
    if (_title != title) {
        [_title release];
        _title = [title retain];
    }
    self.titleLabel.text = title;
}

- (void)createView {

    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    [_titleLabel release];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    _titleLabel.textColor = [UIColor grayColor];
    [self addSubview:self.titleLabel];
    
    self.firstImage = [[UIImageView alloc] initWithFrame:CGRectZero];
    [_firstImage release];
    _firstImage.backgroundColor = [UIColor colorWithRed:230 / 255.0 green:230 / 255.0 blue:240 / 255.0 alpha:1];
    _firstImage.image = [UIImage imageNamed:@"placeholderImage"];
    _firstImage.contentMode = UIViewContentModeScaleAspectFill;
    _firstImage.clipsToBounds = YES;
    [self addSubview:self.firstImage];
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
